cmake_minimum_required(VERSION 3.16)

project(smart_home_1 VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.2 REQUIRED COMPONENTS Quick)

set(CMAKE_AUTORCC ON)
qt_add_executable(appsmart_home_1
    main.cpp
    qml.qrc
    img.qrc
)

qt_add_qml_module(appsmart_home_1
    URI smart_home_1
    VERSION 1.0
    QML_FILES Main.qml
    QML_FILES BigCard.qml
    QML_FILES MiddleCard.qml
    QML_FILES SmallCard.qml
    QML_FILES MyHome.qml
    QML_FILES Room.qml
    QML_FILES TopBtn.qml
    RESOURCES qml.qrc
    RESOURCES img.qrc
    QML_FILES FuzzyPanel.qml
    QML_FILES MiddleButton.qml
    QML_FILES Dock.qml
    QML_FILES SelectBtn.qml
    QML_FILES LivingRoom.qml
    QML_FILES BedRoom.qml
    QML_FILES Kitchen.qml
    QML_FILES Canteen.qml
    QML_FILES
    QML_FILES
    SOURCES mytcpsocket.h mytcpsocket.cpp
    QML_FILES DockBtn.qml
    QML_FILES Device.qml
    QML_FILES Scene.qml
    QML_FILES DeviceCard.qml
    QML_FILES RoomDeviceListPage.qml
    QML_FILES DeviceList.qml
    QML_FILES RoomList.qml
    QML_FILES SecurityCard.qml
    QML_FILES Camera.qml
)

set_target_properties(appsmart_home_1 PROPERTIES
    MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appsmart_home_1
    PRIVATE Qt6::Quick
)

include(GNUInstallDirs)
install(TARGETS appsmart_home_1
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
